<template>
  <v-row justify="center" style="position:absolute;" >
    <v-dialog
      v-model="dialog"
      persistent
      max-width="400px"
    >
      <v-card>
        <v-card-text>
          <v-container>
            <v-row>
              <v-col
                cols="12"
              >
                <v-text-field
                  :label="keyword"
                  required
                  v-model="filename"
                ></v-text-field>
              </v-col>
            </v-row>
          </v-container>
        <v-card-actions>
          <v-spacer></v-spacer>
          <v-btn
            color="blue darken-1"
            text
            @click="dialog = false"
          >
            取消
          </v-btn>
          <v-btn
            color="blue darken-1"
            text
            @click="confirm"
          >
            确认
          </v-btn>
        </v-card-actions>
        </v-card-text>
      </v-card>
    </v-dialog>
  </v-row>
</template>
<style scoped>
.v-dialog > .v-card > .v-card__text{
    padding:0 !important;
}
.v-card__actions{
    margin-top:-30px !important;
}
</style>
<script>
  export default {
    data: () => ({
      dialog: false,
      filename: "",
      callback: null,
      keyword:"",
    }),
    methods: {
        showDialog(createFile, kw) {
            this.keyword = kw
            this.callback = createFile
            this.dialog = true
        },
        confirm(){
            this.dialog = false
            if(this.filename.trim(" ") == "") return
            this.callback(this.filename)
            this.filename = ""
        }
    }
  }
</script>

